package stdio.costa.imoca.spi;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import stdio.costa.imoca.dao.ReceiverDao;
import stdio.costa.imoca.model.MocaUser;
import stdio.costa.imoca.model.Receiver;

@Component
public class ReceiverSpi {

	@Autowired
	private ReceiverDao receiverDao;

	public void save(Receiver receiver) {
		this.receiverDao.save(receiver);
	}

	public Receiver update(Receiver receiver) {
		return receiverDao.update(receiver);
	}

	public void delete(Receiver receiver) {
		this.receiverDao.delete(receiver);
	}

	public Receiver findReceiverByNameAndSender(String name, MocaUser sender) {
		return this.receiverDao.findReceiverByNameAndSender(name, sender);
	}

	public Receiver findReceiverByUuidAndSender(String uuid, MocaUser sender) {
		return this.receiverDao.findReceiverByUuidAndSender(uuid, sender);
	}

	public List<Receiver> findAllReceiversBySender(MocaUser sender) {
		return this.receiverDao.findAllReceiversBySender(sender);
	}
}
